import time
import datetime

date_tuple = (2022, 10, 11, 16, 39, 56, 1, 284, 0)
# 1.将时间元组转换为字符串
print(time.asctime(date_tuple))

# 2.将秒转换为时间元组
print(time.localtime())

for i in time.localtime():
    print(i)



# 3.获取当前时间
print(datetime.date.today())
print(datetime.datetime.now())
# 4.格式输出
print(datetime.date(2022, 10, 1))
print(datetime.time(23, 12, 40))

# 5.时间格式化为字符串
dt = datetime.datetime.now()
print(dt.strftime("%Y-%m-%d %H:%M:%S"))
